<template>
  <div>
    <div class="del">
      <b-field label="删除节点">
        <b-input v-model="delId" placeholder="填入删除节点ID"></b-input>
        <b-button type="is-success" @click="delPoint()">删除</b-button>
      </b-field>
    </div>
    <div class="del">
      <b-field label="查询节点信息">
        <b-input v-model="id" placeholder="填入查询节点ID"></b-input>
        <b-button type="is-info" @click="findone()">查询</b-button>
      </b-field>
    </div>
    <div class="del">
      <b-field label="修改节点信息">
        <b-input v-model="cid" placeholder="填入修改节点ID"></b-input>
        <b-input v-model="name" placeholder="要修改的名称"></b-input>
        <b-input v-model="degree" placeholder="填入Degree"></b-input>
        <b-button type="is-info" @click="change()">修改</b-button>
      </b-field>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      delId: "",
      id:"",
      cid:"",
      degree:"",
      name:"",
    };
  },
  methods: {
    async delPoint() {
      let res = await this.$http.get("api/2backcode/point/delete", {
        params: {
          pointId: this.delId,
        },
      });
      console.log(res.data);
      this.$buefy.dialog.alert("删除成功");
    },
    async findone() {
      let res = await this.$http.get("api/2backcode/point/findone", {
        params: {
          pointId: this.id,
        },
      });
      console.log(res.data);
      this.$buefy.dialog.alert("名称："+res.data.pointName+" 层次："+res.data.degree);
    },
    async change(){
      let res=await this.$http.put("api/2backcode/point/update",{
        pointId:this.cid,
        pointName:this.name,
        degree:this.degree,
      })
      console.log(res.data)
      this.$buefy.dialog.alert("修改成功! 修改后id："+res.data.pointId+"  修改后name"+res.data.pointName+"  修改后degree"+res.data.degree)
    }
  },
  async mounted() {},
};
</script>

<style>
.del {
  width: 500px;
  margin: 0 auto;
}
</style>
